import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { HttpExceptionFilter } from './common/filters/error.filters';
import { TransformInterceptor } from './common/interceptors/transform.interceptor';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
async function bootstrap() {
    const app = await NestFactory.create(AppModule);
    //过滤器
    app.useGlobalFilters(new HttpExceptionFilter());

    //拦截器
    app.useGlobalInterceptors(new TransformInterceptor());

    //跨域
    app.enableCors();

    const options = new DocumentBuilder()
        .setTitle('可视化 Api ')
        .setDescription('酒店可视化')
        .setVersion('1.0')
        .addTag('Api/V1')
        .build();
    const document = SwaggerModule.createDocument(app, options);
    SwaggerModule.setup('/api', app, document);

    await app.listen(3000);
}
bootstrap();
